home *** CD-ROM | disk | FTP | other *** search
- property pOrigMember, pDraggingMember, pPourableMember, pPourSound, pSpr, pNumPourPositions, pIngredient, pLiquidColor, pTilt, pOrigSprite, pLastPourDest
- global gDraggingBottle, gMatrixMode, gQuickPlayMode, gDemoVersion
-
- on beginSprite me
- pSpr = sprite(me.spriteNum)
- pSpr.locZ = 125
- end
-
- on endSprite me
- pSpr.locZ = me.spriteNum
- removeFromActorList(pSpr)
- end
-
- on mPickUpBottle me, bottleSprite, keepOrigVisible, liquidColor, ingredient, pourSound, pickupSound, cursorOffset
- global gLastIngredient, gSoundFXchan
- hideToolTip()
- storeLastIngredient(ingredient)
- gDraggingBottle = me.spriteNum
- addToActorList(pSpr)
- if inBonusMode() then
- playBonusSound(gSoundFXchan, "BRA_X03")
- else
- if voidp(pickupSound) then
- clickSound()
- else
- soundFX(pickupSound, 0, 0)
- end if
- end if
- hideCursor()
- pPourSound = pourSound
- if voidp(liquidColor) then
- pLiquidColor = red()
- else
- pLiquidColor = liquidColor
- end if
- pIngredient = ingredient
- pNumPourPositions = 6
- pOrigSprite = bottleSprite
- pOrigMember = bottleSprite.member
- pTilt = bottleSprite.pTilt
- setPourableBottle(me, 0)
- if not keepOrigVisible then
- bottleSprite.visible = 0
- end if
- switchMember(me, pDraggingMember)
- if not ilk(cursorOffset, #point) then
- cursorOffset = the mouseLoc
- end if
- placeCursor(cursorOffset)
- pSpr.loc = cursorOffset
- pSpr.visible = 1
- pSpr.member.useAlpha = 1
- resetPourMeter()
- updateStage()
- end
-
- on setPourableBottle me, toggle
- if toggle then
- if pTilt = #right then
- pTilt = #left
- else
- pTilt = #right
- end if
- end if
- dragThang = 1
- pourThang = 4
- pDraggingMember = sendSprite(pOrigSprite, #mSetNewTilt, pTilt)
- if voidp(pDraggingMember) then
- leftBottlesOffset = 10
- if pTilt = #right then
- pDraggingMember = nextMember(pOrigMember, dragThang)
- pPourableMember = nextMember(pOrigMember, pourThang)
- else
- pDraggingMember = nextMember(pOrigMember, dragThang + leftBottlesOffset)
- pPourableMember = nextMember(pOrigMember, pourThang + leftBottlesOffset)
- end if
- else
- pPourableMember = nextMember(pDraggingMember, pourThang - dragThang)
- end if
- end
-
- on mReplaceIt me
- if not gDraggingBottle then
- exit
- end if
- pSpr.visible = 0
- removeFromActorList(pSpr)
- gDraggingBottle = 0
- pIngredient = VOID
- resetCursor()
- sendSprite(pOrigSprite, #mReplaceIt)
- end
-
- on tiltBottle me
- switchMember(me, pPourableMember)
- if gMatrixMode or (commandOrControlDown() and the shiftDown) then
- pSpr.trails = 1
- soundFX2("wah-wah")
- else
- end if
- repeat with X = 1 to pNumPourPositions
- if gDemoVersion or gQuickPlayMode or (the shiftDown and not commandOrControlDown()) then
- pSpr.memberNum = pSpr.memberNum + pNumPourPositions
- updateStage()
- exit repeat
- next repeat
- end if
- pSpr.memberNum = pSpr.memberNum + 1
- updateStage()
- end repeat
- end
-
- on untiltBottle me
- pSpr.trails = 0
- if gMatrixMode then
- end if
- quickDip = the shiftDown and not commandOrControlDown()
- repeat with X = 1 to pNumPourPositions
- if gDemoVersion or gQuickPlayMode or quickDip then
- pSpr.memberNum = pSpr.memberNum - pNumPourPositions
- exit repeat
- else
- pSpr.memberNum = pSpr.memberNum - 1
- end if
- updateStage()
- end repeat
- switchMember(me, pPourableMember)
- end
-
- on pour me, ingredient, receiveSound
- global gBarGlassSprites, gMachineSpeed, gPourThrottleRate, gEvenPouring, gLastVessel
- if inBonusMode() then
- playBonusSoundDrop()
- sendSprite(the clickOn, #mDropIngredient, pIngredient)
- exit
- end if
- if not voidp(receiveSound) then
- pPourSound = receiveSound
- end if
- dest = overPourableItem(me)
- if dest <> pLastPourDest then
- pLastPourDest = dest
- resetPourMeter()
- end if
- if dest then
- if isSodaIngredient(ingredient) then
- if sendSprite(dest, #mHasIce) then
- pPourSound = "gun_into_ice"
- else
- pPourSound = "gun_into_glass"
- end if
- else
- if isPowder(ingredient) then
- pPourSound = "sugar_sound"
- else
- if voidp(pPourSound) then
- if sendSprite(dest, #mHasIce) then
- pPourSound = "water_into_mglass"
- else
- pPourSound = "water_into_mglass_wice"
- end if
- end if
- end if
- end if
- end if
- tiltBottle(me)
- if getOne(gBarGlassSprites, dest) then
- if sprite(barSlotToSprite(glassSpriteToBarSlot(dest))).pDrinksBeenServed then
- chillYouveServedDrink()
- exit
- end if
- gLastVessel = glassSpriteToBarSlot(dest)
- end if
- if ingredient <> #ice then
- soundFX(pPourSound, 1, 0)
- end if
- extraLiquid = 0
- startPour = nowTicks()
- totalPoured = 0
- dest = overPourableItem(me)
- if getOne(gBarGlassSprites, dest) then
- makePatronActive(glassSpriteToBarSlot(dest))
- gLastVessel = glassSpriteToBarSlot(dest)
- updateStage()
- end if
- repeat while the stillDown
- dest = overPourableItem(me)
- if dest then
- lastDest = sprite(dest)
- basePourSpeed = getPourSpeed(pIngredient)
- if the optionDown then
- multiplier = 2.5
- else
- if the controlDown then
- multiplier = 0.5
- else
- if the commandDown then
- multiplier = 5
- else
- multiplier = 1
- end if
- end if
- end if
- extraLiquid = max(0, extraLiquid + multiplier - 1)
- if gEvenPouring then
- numIncrements = ticksSince(startPour) / gPourThrottleRate
- else
- numIncrements = ticksSince(startPour) / float(gPourThrottleRate)
- end if
- shouldHaveBeenPoured = (numIncrements + extraLiquid) * basePourSpeed
- missingLiquid = shouldHaveBeenPoured - totalPoured + (multiplier * basePourSpeed)
- slowStart = 0.25
- if totalPoured < slowStart then
- missingLiquid = min(missingLiquid, slowStart / 2)
- end if
- if not gEvenPouring then
- if missingLiquid >= (basePourSpeed * 4) then
- gMachineSpeed = #verySlow
- else
- if missingLiquid >= (basePourSpeed * 3) then
- gMachineSpeed = #slow
- else
- if missingLiquid > (basePourSpeed * 2) then
- gMachineSpeed = #medium
- else
- gMachineSpeed = #fast
- end if
- end if
- end if
- end if
- if the shiftDown then
- POURSPEED = basePourSpeed * multiplier
- else
- if missingLiquid < basePourSpeed then
- POURSPEED = max(0, missingLiquid * multiplier)
- else
- POURSPEED = min(missingLiquid * multiplier, basePourSpeed * 3)
- end if
- end if
- contents = sendSprite(dest, #mIsHoldingVolume)
- if contents < sprite(dest).pCapacity then
- if getOne([#mixingGlass, #shaker, #blender], pIngredient) then
- vessel = sprite([#mixingGlass: 53, #shaker: 51, #blender: 49][ingredient])
- amountLeft = sendSprite(vessel, #mIsHoldingLiquid)
- if amountLeft < POURSPEED then
- POURSPEED = amountLeft
- end if
- end if
- if (contents + POURSPEED) > sprite(dest).pCapacity then
- POURSPEED = sprite(dest).pCapacity - contents
- end if
- sendSprite(dest, #mFill, pIngredient, pLiquidColor)
- runPourMeter(POURSPEED)
- totalPoured = totalPoured + POURSPEED
- Quantity = readPourMeter()
- if objectp(lastDest) then
- case ingredient of
- #mixingGlass, #shaker, #blender:
- gLastVessel = ingredient
- vessel = sprite([#mixingGlass: 53, #shaker: 51, #blender: 49][ingredient])
- readFrom = vessel.pContents
- vessel.pLastDest = lastDest
- liquorQuantity = sendSprite(vessel, #mIsHoldingPourable)
- if liquorQuantity <= 0 then
- alertBeep()
- exit repeat
- end if
- lastDest.pContents[pIngredient] = 1
- numIngredients = count(readFrom)
- repeat with X = 1 to numIngredients
- subIngredient = getPropAt(readFrom, X)
- if subIngredient = #ice then
- subIngredient = #iceNonGlass
- end if
- if subIngredient <> #Slush then
- if voidp(lastDest.pContents[subIngredient]) then
- lastDest.pContents[subIngredient] = 0
- end if
- end if
- end repeat
- repeat with X = numIngredients down to 1
- subIngredient = getPropAt(readFrom, X)
- case subIngredient of
- #ice:
- if voidp(vessel.pContents[#ice]) then
- nothing()
- else
- lastDest.pContents[#iceNonGlass] = vessel.pContents[#ice]
- end if
- #blend, #shake, #stir, #Muddle:
- lastDest.pContents[subIngredient] = 1
- deleteProp(vessel.pContents, subIngredient)
- #olive, #lemonWedge, #orangeWedge, #limeWedge, #cherry, #limetwist, #lemontwist:
- lastDest.pContents[subIngredient] = vessel.pContents[subIngredient]
- deleteProp(vessel.pContents, subIngredient)
- otherwise:
- if subIngredient = #Slush then
- if liquorQuantity <> vessel.pContents[#Slush] then
- next repeat
- end if
- end if
- if voidp(lastDest.pContents[subIngredient]) then
- lastDest.pContents[subIngredient] = 0
- end if
- if liquorQuantity > 0 then
- transfer = readFrom[X] * min(1.0, float(POURSPEED) / liquorQuantity)
- else
- exit repeat
- end if
- lastDest.pContents[subIngredient] = lastDest.pContents[subIngredient] + transfer
- vessel.pContents[X] = max(0, vessel.pContents[X] - transfer)
- if vessel.pContents[X] <= 0 then
- deleteAt(vessel.pContents, X)
- end if
- liquorQuantity = sendSprite(vessel, #mIsHoldingPourable)
- if liquorQuantity <= 0 then
- sendSprite(vessel, #mEmptyGlass)
- end if
- end case
- end repeat
- sendSprite(vessel.pGlassMask, #mUpdateLiquidLevel, vessel)
- otherwise:
- if voidp(lastDest.pContents[ingredient]) then
- lastDest.pContents[ingredient] = 0
- end if
- lastDest.pContents[ingredient] = lastDest.pContents[ingredient] + POURSPEED
- end case
- end if
- if objectp(lastDest) then
- lastDest.pContentString = EMPTY
- newString = buildVesselContentList(lastDest, lastDest.pGlassType, " The Glass is Empty")
- showDrinkContents(ingredient, newString, Quantity)
- end if
- else
- stopSoundFX()
- alertBeep()
- exit repeat
- end if
- updateStage()
- checkElapsedTime()
- if the shiftDown then
- exit repeat
- end if
- next repeat
- end if
- exit repeat
- end repeat
- if not voidp(vessel) then
- vessel.pContentString = VOID
- end if
- stopSoundFX()
- untiltBottle(me)
- end
-
- on mFlip me
- if not draggingBottleThang() then
- exit
- end if
- if pTilt = #right then
- startFrom = 3
- endAt = 10
- startFrom2 = 20
- endAt2 = 13
- else
- startFrom = 13
- endAt = 20
- startFrom2 = 10
- endAt2 = 3
- end if
- repeat with X = startFrom to endAt
- pSpr.member = nextMember(pOrigMember, X)
- updateStage()
- end repeat
- repeat with X = startFrom2 down to endAt2
- pSpr.member = nextMember(pOrigMember, X)
- updateStage()
- end repeat
- setPourableBottle(me, 1)
- updateStage()
- end
-
- on switchMember me, newMember
- if pSpr.member <> newMember then
- pSpr.member = newMember
- end if
- end
-
- on stepFrame me
- if not gMatrixMode then
- pSpr.loc = the mouseLoc
- end if
- end
-
- on exitFrame me
- if draggingBottleThang() then
- if overPourableItem(me) then
- switchMember(me, pPourableMember)
- else
- if pIngredient = #shaker then
- nothing()
- else
- switchMember(me, pDraggingMember)
- end if
- end if
- pSpr.loc = the mouseLoc
- if pTilt = #right then
- if pSpr.rect.left < -20 then
- setPourableBottle(me, 1)
- switchMember(me, pDraggingMember)
- end if
- else
- if pSpr.rect.right > 665 then
- setPourableBottle(me, 1)
- switchMember(me, pDraggingMember)
- end if
- end if
- updateStage()
- end if
- end
-
- on overPourableItem me
- global gPourableItemsList
- repeat with X in gPourableItemsList
- if sendSprite(X, #mOverItem, pSpr, the mouseLoc, pIngredient) and (X <> pOrigSprite) then
- if (X = 89) or (X = 85) or (X = 81) then
- return X - 2
- next repeat
- end if
- return X
- end if
- end repeat
- return 0
- end
-